package com.gopay.common;

import com.gopay.common.constants.bank.BankOrderStatus;
import org.apache.commons.lang3.StringUtils;

/**
 * @ClassName: BankOrderTranslateUtil
 * @Description: bankOrder status字段翻译，自动结算-结算结果查询页面使用
 * @Author: tianxin
 * @Date: 2018/1/30 17:20 www.gopay.com.cn Inc.All rights reserved.
 */
public class BankOrderTranslateUtil {

    /**
     * 已发往银行，但结果未知
     */
    public static final String PROCESS = "银行订单进行中";

    /**
     * 我司已受理，尚未发往银行
     */
    public static final String ACCEPTED = "银行订单已受理";

    /**
     * 超时等异常情况导致未能生成银行订单
     */
    public static final String NULL = "银行订单未生成";

    public static final String SUCCESS = "银行订单成功";

    public static final String FAIL = "银行订单失败";



    /**
     * 翻译银行订单状态
     * @param status
     * @return
     */
    public static String translateBankOrderStatus(String status){
        if (StringUtils.isNotEmpty(status)) {
            switch (status){
                case BankOrderStatus.PROCESS: {
                    return PROCESS;
                }
                case BankOrderStatus.ACCEPTED:{
                    return ACCEPTED;
                }
                case BankOrderStatus.BANK_CALL_SUCCESS:
                case BankOrderStatus.AUTO_CHECK_SUCCESS:
                case BankOrderStatus.CHECK_SUCCESS:
                case BankOrderStatus.BPS_CHECK_SUCCESS:{
                    return SUCCESS;
                }
                case BankOrderStatus.FAIL:
                case BankOrderStatus.ORDER_FAIL:
                case BankOrderStatus.VERIFY_FAIL:
                case BankOrderStatus.AMOUNT_ERROR:
                case BankOrderStatus.CANCEL:
                case BankOrderStatus.TIMEOUT:
                case BankOrderStatus.ENTER_ACCOUNT_FIAL:{
                    return FAIL;
                }
                default:{
                    return "";
                }
            }
        }else {
            return NULL;
        }

    }
}
